package com.future.mayi.dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.future.baselib.utils.CommonUtils;
import com.future.mayi.R;
import com.future.mayi.model.interfaces.DialogEnterListener;

/**
 * 确认收货
 */
public class ConfirmGoodsDialog extends Dialog{

    public ConfirmGoodsDialog(@NonNull Context context) {
        super(context, R.style.dialog);
        init(context);
    }


    private DialogEnterListener listener;

    private void init(Context context) {
        View layout = LayoutInflater.from(context).inflate(R.layout.dialog_confirm_goods, null);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams((int) ( CommonUtils.getScreenSize(context)[0] * 0.65f), ViewGroup.LayoutParams.WRAP_CONTENT);
        setContentView(layout, params);        findViewById(R.id.tv_cancel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null)
                    listener.cancel(null);

            }
        });
        findViewById(R.id.tv_enter).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (listener != null)
                    listener.enter(null);

            }
        });
    }

    public void setListener(DialogEnterListener listener) {
        this.listener = listener;
    }

}
